package com.bcu.calculus.controller;

import com.bcu.calculus.entity.Message;
import com.bcu.calculus.entity.Review;
import com.bcu.calculus.entity.Unpass;
import com.bcu.calculus.service.ReviewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "05  复核模块")
@RestController
@RequestMapping("/api/review")
public class ReviewController {

    @Resource
    private ReviewService reviewService;

    @ApiOperation(value = "添加复核")
    @PostMapping(value = "/add")
    public Message<?> addReview(Review review){
        return reviewService.add(review);
    }

    @ApiOperation(value = "删除复核")
    @DeleteMapping(value = "/del")
    public Message<?> delReview(Integer reviewId){
        return reviewService.del(reviewId);
    }

    @ApiOperation(value = "修改复核")
    @PutMapping(value = "/update")
    public Message<?> updateReview(Review review){
        return reviewService.update(review);
    }

    @ApiOperation(value = "查找复核")
    @GetMapping(value = "/getAll")
    public Message<List<Review>> findAll(){
        return reviewService.selectAll();
    }

    @ApiOperation(value = "通过主键查找复核")
    @GetMapping(value = "/getByPK")
    public Message<Review> findByPK(Integer reviewId){
        return reviewService.selectByPK(reviewId);
    }

    @ApiOperation(value = "通过sendId查找复核")
    @GetMapping(value = "/getBySendId")
    public Message<Review> findBySendId(String sendId){
        return reviewService.selectBySendId(sendId);
    }

}
